#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 15, M = 105;
int w[N], m, f[M];
int main() {
	for (int i = 1; i <= 10; i++) {
		scanf ("%d", &w[i]);
	}
	scanf ("%d", &m);
	memset (f, 0x7f, sizeof(f));
	f[0] = 0;
	f[1] = w[1];
	for (int i = 1; i <= 10; i++) {
		for (int j = i; j <= m; j++) {
			f[j] = min (f[j], f[j - i] + w[i]);
		}
	}
	printf ("%d\n", f[m]);
	return 0;
}